from sentry.search.eap import constants
from sentry.search.eap.columns import ResolvedAttribute, datetime_processor
from sentry.search.eap.common_columns import COMMON_COLUMNS

UPTIME_ATTRIBUTE_DEFINITIONS = {
    column.public_alias: column
    for column in COMMON_COLUMNS
    + [
        ResolvedAttribute(
            public_alias="id",
            internal_name="sentry.item_id",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="trace",
            internal_name="sentry.trace_id",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="span_id",
            internal_name="span_id",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="environment",
            internal_name="environment",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="guid",
            internal_name="guid",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="subscription_id",
            internal_name="subscription_id",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="check_id",
            internal_name="check_id",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="check_status",
            internal_name="check_status",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="region",
            internal_name="region",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="timestamp",
            internal_name="sentry.timestamp",
            internal_type=constants.DOUBLE,
            search_type="string",
            processor=datetime_processor,
        ),
        ResolvedAttribute(
            public_alias="scheduled_check_time_us",
            internal_name="scheduled_check_time_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="actual_check_time_us",
            internal_name="actual_check_time_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="check_duration_us",
            internal_name="check_duration_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="status_reason_type",
            internal_name="status_reason_type",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="status_reason_description",
            internal_name="status_reason_description",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="method",
            internal_name="method",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="original_url",
            internal_name="original_url",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="request_sequence",
            internal_name="request_sequence",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="request_type",
            internal_name="request_type",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="request_url",
            internal_name="request_url",
            search_type="string",
        ),
        ResolvedAttribute(
            public_alias="http_status_code",
            internal_name="http_status_code",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="request_body_size_bytes",
            internal_name="request_body_size_bytes",
            search_type="byte",
        ),
        ResolvedAttribute(
            public_alias="response_body_size_bytes",
            internal_name="response_body_size_bytes",
            search_type="byte",
        ),
        ResolvedAttribute(
            public_alias="request_duration_us",
            internal_name="request_duration_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="dns_lookup_start_us",
            internal_name="dns_lookup_start_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="dns_lookup_duration_us",
            internal_name="dns_lookup_duration_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="tcp_connection_start_us",
            internal_name="tcp_connection_start_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="tcp_connection_duration_us",
            internal_name="tcp_connection_duration_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="tls_handshake_start_us",
            internal_name="tls_handshake_start_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="tls_handshake_duration_us",
            internal_name="tls_handshake_duration_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="time_to_first_byte_start_us",
            internal_name="time_to_first_byte_start_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="time_to_first_byte_duration_us",
            internal_name="time_to_first_byte_duration_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="send_request_start_us",
            internal_name="send_request_start_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="send_request_duration_us",
            internal_name="send_request_duration_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="receive_response_start_us",
            internal_name="receive_response_start_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="receive_response_duration_us",
            internal_name="receive_response_duration_us",
            search_type="integer",
        ),
        ResolvedAttribute(
            public_alias="incident_status",
            internal_name="incident_status",
            search_type="integer",
        ),
    ]
}
